;
; crt0.s -- Bootstrap routine for crt.c (user programs).
;

; At the start of a program, the cpu state should be:
; On returning from this interrupt, the cpu state should be:
; eax: ptr to argv list. This should be on the kernel heap.
; ebx: ptr to env list. This should also be on the kernel heap.
; esp: A nice healthy stack.

[EXTERN _premain]
[GLOBAL _start]
_start:
  push ebx        ; Put the environment list on the stack first.
  push eax        ; Put the argument list on the stack next.
  call _premain   ; Call our C setup code.
  int 0x3         ; We should never get here. _premain should call _exit.
  hlt             ; so just call a breakpoint exception.
